package search.text;

import java.util.List;

public interface TextIndex
{
    /**
     * Builds a word based index on the specified text.
     *
     * @param text the text to build the index on
     */
    void buildIndex(final String text) throws Exception;

    /**
     * Searches every ocurrence of the specified word in the indexed text.
     *
     * @param word the word to be searched in the indexed text
     *
     * @return a list of integers representing all character positions in the text
     * where there is an ocurrence of the specified word, or an empty list if there are
     * no ocurrences of the word
     */
    List<Integer> search(final String word) throws Exception;
}
